#ifndef _MS2WGEN_H_
#define _MS2WGEN_H_

#include <clx/libECM.h>
#include <clx/ecm_list.h>
#include <time.h>

#include "libms2sim.h"

#define ERR(fmt, ...)	ECMERR("ERR: ms2wgen: " fmt, ## __VA_ARGS__)

extern char	*confpath;
extern ecm_uint32	duration;
extern ecm_uint32	n_medias;
extern ecm_uint32	media_length;
extern ecm_uint32	media_size;

extern ecm_double	arrival_lambda;
extern ecm_double	skew;
extern char		*lpm_mod;
extern char		*output;

extern ecm_double	sesslen_alpha;
extern ecm_double	sesslen_beta;

extern ecm_double	interseek_mu;
extern ecm_double	interseek_sigma;

typedef struct {
	ecm_uint32	tick_start;
	ecm_uint32	tick_end;
	ecm_uint32	startstamp;
	ecm_uint32	endstamp;
	ecm_int32	playback_rate;
	struct list_head	list;
} wg_access_t;

typedef struct {
	ecm_uint32	sid;
	ecm_uint32	mid;

	struct list_head	accesses;
	struct list_head	list;
} wg_session_t;

extern ECMBOOL init_wgenconf(void);
extern void gen_logs(void);

extern void add_wg_session(ecm_uint32 tick);
extern wg_session_t *get_wg_session(ecm_uint32 tick);
extern void put_wg_session(wg_session_t *session);
extern wg_access_t *get_head_access(wg_session_t *session);

extern ECMBOOL init_wg_session(void);

#endif
